home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Apple Location Manager / Sources / Utilities.h < prev   
Encoding:
C/C++ Source or Header  |  1997-05-19  |  2.8 KB  |  102 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Utilities.h
  3.  
  4.      Contains:    Location Manager SDK Sample Module handy routines
  5.  
  6.      Version:    ALM SDK 1.0
  7.                  Package:    Location Manager SDK 1.0
  8.  
  9.      Copyright:    © 1984-1997 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@apple.com
  16.  
  17. */
  18.  
  19. #ifndef        __UTILITIES__
  20. #define        __UTILITIES__
  21.  
  22. // -------------------------------------------------------------------------------------
  23.  
  24. // Project Includes...
  25.  
  26. #ifndef        __SAMPLE__
  27. #include    "Sample.h"
  28. #endif        // __SAMPLE__
  29.  
  30. // SDK Includes...
  31.  
  32. #define        ALM_BASENAME()
  33. #define        ALM_GLOBALS()        GlobalsHandle
  34.  
  35. #ifndef        __LOCATIONMANAGER__
  36. #include    <LocationManager.h>
  37. #endif        // __LOCATIONMANAGER__
  38.  
  39. // MacOS Includes...
  40.  
  41. #ifndef        __COMPONENTS__
  42. #include    <Components.h>
  43. #endif        // __COMPONENTS__
  44.  
  45. // -------------------------------------------------------------------------------------
  46.  
  47. // Module-specific defines...
  48.  
  49. #define        kModuleVersion                0
  50. #define        kSettingVersion                1
  51.  
  52. // -------------------------------------------------------------------------------------
  53.  
  54. // Types...
  55.  
  56. typedef struct {
  57.     UInt32            dateCreated;        // Date file created &
  58.     UInt32            dateModified;        // Date file modified == "changed" indicator...
  59.     UInt32            dataForkOffset;        // Relative position of data fork data...
  60.     UInt32            dataForkLen;        // Length of data fork data...
  61.     UInt32            resForkOffset;        // Resource fork data position...
  62.     UInt32            resForkLen;            // Length of resource fork data...
  63. } FileInfoRec, *FileInfoPtr;
  64.  
  65. typedef struct {
  66.     Component        self;                // Reference back to ourselves for closure...
  67.     SInt32            resFile;            // Reference for our open resource fork...
  68.     UInt32            fileCount;            // Number of records below...
  69.     FSSpec            theFiles[kVariableLengthArray];
  70. } Globals, *GlobalsPtr, **GlobalsHandle;
  71.  
  72. typedef struct {
  73.     UInt32            version;    // Version of the setting...
  74.     UInt32            fileCount;    // Number of records below...
  75.     FileInfoRec        fileInfo[kVariableLengthArray];
  76.     // actual file data follows array...
  77. } SettingRec, *SettingPtr, **SettingHandle;
  78.  
  79. // -------------------------------------------------------------------------------------
  80.  
  81. // Exports...
  82.  
  83. extern OSErr
  84. UseSetting (GlobalsHandle globals, SettingHandle setting, ALMRebootFlags* flags);
  85.     // Make 'setting' the current setting...
  86.  
  87. extern OSErr
  88. ReadSetting (GlobalsHandle globals, SettingHandle setting);
  89.     // Read the system state into setting...
  90.  
  91. extern OSErr
  92. ConfirmFSSpecs (GlobalsHandle globals);
  93.     // Ensure that the FSSpec array in globals conforms to the resource list of files
  94.     // to look for...
  95.  
  96. extern void
  97. InsParamStr (StringPtr matchThis, StringPtr replaceWithThis, StringPtr replaceInThis);
  98.     // Insert 'replaceWithThis' into 'replaceInThis' at the first instance of
  99.     // 'matchThis'...
  100.  
  101. #endif        // __UTILITIES__
  102.